package com.mycompany.project.client;
import com.google.gwt.event.shared.GwtEvent;

/**
 * @author Laboratorio Tv Collaborativa/Contenuti Digitali --> Sardegna District --> Crs4 --> Sardegna Ricerche
 * 
 *  This class extends a GwtEvent class and implements @SaStria FullScreenEvent event and in particular mode  
 *  fire the onCloseFullScreen event. This onCloseFullScreen event should be fired when a user close
 *  a @SaStria full screen video player window. This class is responsible for handle and
 *  dispatch the onCloseFullScreen event.  
 */
public class FullScreenEvent extends GwtEvent<FullScreenEventHandler> {
public static Type<FullScreenEventHandler> TYPE=new Type<FullScreenEventHandler>();
private double posVideo;	// play position of video
private boolean videoPlayin; // true if video is in play, false otherwise. 


	/**
	 * Constructor of this class that sets the the play position and the play status of video player
	 * in @SaStria tool video player before open the full screen mode.
	 * @param pos: play position of video palyer
	 * @param play : play status of video player. if true the video is in play. false otherwise.
	 */
	public FullScreenEvent(double pos,boolean play){
		posVideo=pos;
		videoPlayin=play;
	}

	
	/**
	 * This method return the system parameter TYPE. Type class is used to register events with the HandlerManager.
	 * Type is parameterized by the handler type in order to make the addHandler method type safe.
	 *  Gets the type associated with this event.
	 */
	@Override
	public com.google.gwt.event.shared.GwtEvent.Type<FullScreenEventHandler> getAssociatedType() {
		// TODO Auto-generated method stub
		return TYPE;
	}

	
	/**
	 * This method run and dispatch the onCloseFullScreen event.
	 * Should only be called by HandlerManager.
	 * @param handler: handler of FullScreenEventHandler . 
	 */
	@Override
	protected void dispatch(FullScreenEventHandler handler) {
		// TODO Auto-generated method stub
		handler.onCloseFullScreen(this,posVideo,videoPlayin);
	}

}
